#include "logger.h"
#include <stdio.h>

namespace syntax_analysis
{
	void logger::debug( string msg, char *code, int line )
	{
		char buf[128];
		printf( "debug: %s\n", msg.c_str() );
		snprintf( buf, 127, "at line %d: %s\n", line, code );
		buf[126] = '\n';
		buf[127] = 0;
		printf( buf );
	}

	void logger::warning( string msg, char *code, int line )
	{
		char buf[128];
		printf( "warning: %s\n", msg.c_str() );
		snprintf( buf, 127, "at line %d: %s\n", line, code );
		buf[126] = '\n';
		buf[127] = 0;
		printf( buf );
	}

	void logger::error( string msg, char *code, int line )
	{
		char buf[128];
		printf( "error: %s\n", msg.c_str() );
		snprintf( buf, 127, "at line %d: %s\n", line, code );
		buf[126] = '\n';
		buf[127] = 0;
		printf( buf );
	}

	void logger::critical( string msg, char *code, int line )
	{
		char buf[128];
		printf( "critical: %s\n", msg.c_str() );
		snprintf( buf, 127, "at line %d: %s\n", line, code );
		buf[126] = '\n';
		buf[127] = 0;
		printf( buf );
	}

}
